3.83 \(\int \frac {(2+x) (d+e x+f x^2+g x^3+h x^4)}{4-5 x^2+x^4} \, dx\)

Optimal. Leaf size=74 \[ -\frac {1}{2} \log (1-x) (d+e+f+g+h)+\frac {1}{3} \log (2-x) (d+2 e+4 f+8 g+16 h)+\frac {1}{6} \log (x+1) (d-e+f-g+h)+x (g+2 h)+\frac {h x^2}{2} \]

[Out]

(g+2*h)*x+1/2*h*x^2-1/2*(d+e+f+g+h)*ln(1-x)+1/3*(d+2*e+4*f+8*g+16*h)*ln(2-x)+1/6*(d-e+f-g+h)*ln(1+x)

________________________________________________________________________________________

Rubi [A]  time = 0.11, antiderivative size = 74, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, integrand size = 36, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.056, Rules used = {1586, 2074} \[ -\frac {1}{2} \log (1-x) (d+e+f+g+h)+\frac {1}{3} \log (2-x) (d+2 e+4 f+8 g+16 h)+\frac {1}{6} \log (x+1) (d-e+f-g+h)+x (g+2 h)+\frac {h x^2}{2} \]

Antiderivative was successfully verified.

[In]

Int[((2 + x)*(d + e*x + f*x^2 + g*x^3 + h*x^4))/(4 - 5*x^2 + x^4),x]

[Out]

(g + 2*h)*x + (h*x^2)/2 - ((d + e + f + g + h)*Log[1 - x])/2 + ((d + 2*e + 4*f + 8*g + 16*h)*Log[2 - x])/3 + (
(d - e + f - g + h)*Log[1 + x])/6

Rule 1586

Int[(u_.)*(Px_)^(p_.)*(Qx_)^(q_.), x_Symbol] :> Int[u*PolynomialQuotient[Px, Qx, x]^p*Qx^(p + q), x] /; FreeQ[
q, x] && PolyQ[Px, x] && PolyQ[Qx, x] && EqQ[PolynomialRemainder[Px, Qx, x], 0] && IntegerQ[p] && LtQ[p*q, 0]

Rule 2074

Int[(P_)^(p_)*(Q_)^(q_.), x_Symbol] :> With[{PP = Factor[P]}, Int[ExpandIntegrand[PP^p*Q^q, x], x] /;  !SumQ[N
onfreeFactors[PP, x]]] /; FreeQ[q, x] && PolyQ[P, x] && PolyQ[Q, x] && IntegerQ[p] && NeQ[P, x]

Rubi steps

\begin {align*} \int \frac {(2+x) \left (d+e x+f x^2+g x^3+h x^4\right )}{4-5 x^2+x^4} \, dx &=\int \frac {d+e x+f x^2+g x^3+h x^4}{2-x-2 x^2+x^3} \, dx\\ &=\int \left (g \left (1+\frac {2 h}{g}\right )+\frac {d+2 e+4 f+8 g+16 h}{3 (-2+x)}+\frac {-d-e-f-g-h}{2 (-1+x)}+h x+\frac {d-e+f-g+h}{6 (1+x)}\right ) \, dx\\ &=(g+2 h) x+\frac {h x^2}{2}-\frac {1}{2} (d+e+f+g+h) \log (1-x)+\frac {1}{3} (d+2 e+4 f+8 g+16 h) \log (2-x)+\frac {1}{6} (d-e+f-g+h) \log (1+x)\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 0.03, size = 71, normalized size = 0.96 \[ \frac {1}{6} \left (-3 \log (1-x) (d+e+f+g+h)+2 \log (2-x) (d+2 (e+2 f+4 g+8 h))+\log (x+1) (d-e+f-g+h)+6 x (g+2 h)+3 h x^2\right ) \]

Antiderivative was successfully verified.

[In]

Integrate[((2 + x)*(d + e*x + f*x^2 + g*x^3 + h*x^4))/(4 - 5*x^2 + x^4),x]

[Out]

(6*(g + 2*h)*x + 3*h*x^2 - 3*(d + e + f + g + h)*Log[1 - x] + 2*(d + 2*(e + 2*f + 4*g + 8*h))*Log[2 - x] + (d
- e + f - g + h)*Log[1 + x])/6

________________________________________________________________________________________

fricas [A]  time = 1.03, size = 62, normalized size = 0.84 \[ \frac {1}{2} \, h x^{2} + {\left (g + 2 \, h\right )} x + \frac {1}{6} \, {\left (d - e + f - g + h\right )} \log \left (x + 1\right ) - \frac {1}{2} \, {\left (d + e + f + g + h\right )} \log \left (x - 1\right ) + \frac {1}{3} \, {\left (d + 2 \, e + 4 \, f + 8 \, g + 16 \, h\right )} \log \left (x - 2\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((2+x)*(h*x^4+g*x^3+f*x^2+e*x+d)/(x^4-5*x^2+4),x, algorithm="fricas")

[Out]

1/2*h*x^2 + (g + 2*h)*x + 1/6*(d - e + f - g + h)*log(x + 1) - 1/2*(d + e + f + g + h)*log(x - 1) + 1/3*(d + 2
*e + 4*f + 8*g + 16*h)*log(x - 2)

________________________________________________________________________________________

giac [A]  time = 0.33, size = 68, normalized size = 0.92 \[ \frac {1}{2} \, h x^{2} + g x + 2 \, h x + \frac {1}{6} \, {\left (d + f - g + h - e\right )} \log \left ({\left | x + 1 \right |}\right ) - \frac {1}{2} \, {\left (d + f + g + h + e\right )} \log \left ({\left | x - 1 \right |}\right ) + \frac {1}{3} \, {\left (d + 4 \, f + 8 \, g + 16 \, h + 2 \, e\right )} \log \left ({\left | x - 2 \right |}\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((2+x)*(h*x^4+g*x^3+f*x^2+e*x+d)/(x^4-5*x^2+4),x, algorithm="giac")

[Out]

1/2*h*x^2 + g*x + 2*h*x + 1/6*(d + f - g + h - e)*log(abs(x + 1)) - 1/2*(d + f + g + h + e)*log(abs(x - 1)) +
1/3*(d + 4*f + 8*g + 16*h + 2*e)*log(abs(x - 2))

________________________________________________________________________________________

maple [A]  time = 0.01, size = 120, normalized size = 1.62 \[ \frac {h \,x^{2}}{2}+\frac {d \ln \left (x -2\right )}{3}-\frac {d \ln \left (x -1\right )}{2}+\frac {d \ln \left (x +1\right )}{6}+\frac {2 e \ln \left (x -2\right )}{3}-\frac {e \ln \left (x -1\right )}{2}-\frac {e \ln \left (x +1\right )}{6}+\frac {4 f \ln \left (x -2\right )}{3}-\frac {f \ln \left (x -1\right )}{2}+\frac {f \ln \left (x +1\right )}{6}+g x +\frac {8 g \ln \left (x -2\right )}{3}-\frac {g \ln \left (x -1\right )}{2}-\frac {g \ln \left (x +1\right )}{6}+2 h x +\frac {16 h \ln \left (x -2\right )}{3}-\frac {h \ln \left (x -1\right )}{2}+\frac {h \ln \left (x +1\right )}{6} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((x+2)*(h*x^4+g*x^3+f*x^2+e*x+d)/(x^4-5*x^2+4),x)

[Out]

1/2*h*x^2+g*x+2*h*x+1/3*d*ln(x-2)+2/3*e*ln(x-2)+4/3*f*ln(x-2)+8/3*g*ln(x-2)+16/3*h*ln(x-2)+1/6*d*ln(x+1)-1/6*e
*ln(x+1)+1/6*f*ln(x+1)-1/6*g*ln(x+1)+1/6*h*ln(x+1)-1/2*d*ln(x-1)-1/2*e*ln(x-1)-1/2*f*ln(x-1)-1/2*g*ln(x-1)-1/2
*h*ln(x-1)

________________________________________________________________________________________

maxima [A]  time = 0.45, size = 62, normalized size = 0.84 \[ \frac {1}{2} \, h x^{2} + {\left (g + 2 \, h\right )} x + \frac {1}{6} \, {\left (d - e + f - g + h\right )} \log \left (x + 1\right ) - \frac {1}{2} \, {\left (d + e + f + g + h\right )} \log \left (x - 1\right ) + \frac {1}{3} \, {\left (d + 2 \, e + 4 \, f + 8 \, g + 16 \, h\right )} \log \left (x - 2\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((2+x)*(h*x^4+g*x^3+f*x^2+e*x+d)/(x^4-5*x^2+4),x, algorithm="maxima")

[Out]

1/2*h*x^2 + (g + 2*h)*x + 1/6*(d - e + f - g + h)*log(x + 1) - 1/2*(d + e + f + g + h)*log(x - 1) + 1/3*(d + 2
*e + 4*f + 8*g + 16*h)*log(x - 2)

________________________________________________________________________________________

mupad [B]  time = 0.88, size = 78, normalized size = 1.05 \[ x\,\left (g+2\,h\right )+\frac {h\,x^2}{2}-\ln \left (x-1\right )\,\left (\frac {d}{2}+\frac {e}{2}+\frac {f}{2}+\frac {g}{2}+\frac {h}{2}\right )+\ln \left (x+1\right )\,\left (\frac {d}{6}-\frac {e}{6}+\frac {f}{6}-\frac {g}{6}+\frac {h}{6}\right )+\ln \left (x-2\right )\,\left (\frac {d}{3}+\frac {2\,e}{3}+\frac {4\,f}{3}+\frac {8\,g}{3}+\frac {16\,h}{3}\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(((x + 2)*(d + e*x + f*x^2 + g*x^3 + h*x^4))/(x^4 - 5*x^2 + 4),x)

[Out]

x*(g + 2*h) + (h*x^2)/2 - log(x - 1)*(d/2 + e/2 + f/2 + g/2 + h/2) + log(x + 1)*(d/6 - e/6 + f/6 - g/6 + h/6)
+ log(x - 2)*(d/3 + (2*e)/3 + (4*f)/3 + (8*g)/3 + (16*h)/3)

________________________________________________________________________________________

sympy [F(-1)]  time = 0.00, size = 0, normalized size = 0.00 \[ \text {Timed out} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((2+x)*(h*x**4+g*x**3+f*x**2+e*x+d)/(x**4-5*x**2+4),x)

[Out]

Timed out

________________________________________________________________________________________